﻿// zc2.cpp: 实现文件
//

#include "pch.h"
#include "luntan.h"
#include "zc2.h"
#include "afxdialogex.h"
#include "zc0.h"
#include"luntanDlg.h"



// zc2 对话框

IMPLEMENT_DYNAMIC(zc2, CDialogEx)

zc2::zc2(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_ZC2, pParent)
	, m_adminid(_T(""))
	, m_adminname(_T(""))
	, m_adminpwd(_T(""))
{

}

zc2::~zc2()
{
}

void zc2::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_adminid);
	DDX_Text(pDX, IDC_EDIT2, m_adminname);
	DDX_Text(pDX, IDC_EDIT3, m_adminpwd);
}


BEGIN_MESSAGE_MAP(zc2, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON2, &zc2::OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON3, &zc2::OnBnClickedButton3)
	ON_BN_CLICKED(IDC_BUTTON1, &zc2::OnBnClickedButton1)
END_MESSAGE_MAP()


// zc2 消息处理程序


void zc2::OnBnClickedButton2()
{
	// TODO: 在此添加控件通知处理程序代码
	zc2::OnOK();
	CluntanDlg a;
	a.DoModal();
}


void zc2::OnBnClickedButton3()
{
	// TODO: 在此添加控件通知处理程序代码
	zc2::OnOK();
	zc0 a;
	a.DoModal();
}


void zc2::OnBnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	CString sql, sql1;
	UpdateData(TRUE);
	
	if (m_adminid != "" && m_adminname !=""&& m_adminpwd != "")
	{
		
		ADOConn m_AdoConn;
		m_AdoConn.OnInitADOConn();
		sql.Format("insert into Admin(Admin_id,Admin_Name,Admin_Pwd) values('%s','%s','%s')", m_adminid, m_adminname, m_adminpwd);
		m_AdoConn.ExecuteSQL((_bstr_t)sql);
		MessageBox("注册成功", "注册结果");
		m_adminid = "", m_adminname = "", m_adminpwd = "";
		UpdateData(FALSE);
			
		
	}
	else
	{
		MessageBox("注册信息不能为空！", "提示", MB_ICONWARNING);
	}
}
